home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr13 / tstse13.zip / TOASC.S < prev    next >
Text File  |  1995-02-19  |  4KB  |  128 lines

  1. /* Scandinavian conversions for SemWare's TSE editor V2.0. To make
  2.    this SAL macro operational, invoke the main menu (F10), choose
  3.    "Macro", choose "Compile" and press Enter at "Execute Macro".
  4.  
  5. ..................................................................
  6. Prof. Timo Salmi      Co-moderator of comp.archives.msdos.announce
  7. Moderating at garbo.uwasa.fi anonymous FTP archives  193.166.120.5
  8. Department of Accounting and Business Finance; University of Vaasa
  9. Internet: ts@uwasa.fi   BBS +(358)-61-3170972; FIN-65101,  Finland
  10. */
  11.  
  12. // The contents of a simple help, tied later to the CtrlAlt-H key
  13. helpdef tHelpData
  14.   title = "TOASC.S HELP"           // The help's caption
  15.   x = 10                           // Location
  16.   y = 3
  17.   // The actual help text
  18.   " Prof. Timo Salmi's Scandinavian conversions"
  19.   ""
  20.   " These procedures are for converting the Scandinavian "
  21.   " characters between different conventions."
  22.   ""
  23.   " You can use <F11> to invoke the command menu after "
  24.   " first exiting this help. "
  25.   ""
  26.   " Last updated Sun 19-February-1995 08:53:31 "
  27. end  /* tHelpData */
  28.  
  29. // Convert 8-bit Scandinavian characters to their local 7-bit counterparts
  30. proc timoIbmToAsc()
  31.   lReplace("å","}","gn")
  32.   lReplace("ä","{","gn")
  33.   lReplace("ö","|","gn")
  34.   lReplace("Å","]","gn")
  35.   lReplace("Ä","[","gn")
  36.   lReplace("Ö","\","gn")
  37. end
  38.  
  39. // Convert local 7-bit Scandinavian characters to their 8-bit IBM
  40. // PC counterparts
  41. proc timoAscToIbm()
  42.   lReplace("}","å","gn")
  43.   lReplace("{","ä","gn")
  44.   lReplace("|","ö","gn")
  45.   lReplace("]","Å","gn")
  46.   lReplace("[","Ä","gn")
  47.   lReplace("\","Ö","gn")
  48. end
  49.  
  50. // Convert 8-bit Latin1 Scandinavian characters to their 8-bit IBM
  51. // PC counterparts
  52. proc timoLat1ToIbm()
  53.   lReplace("Σ","ä","gn")
  54.   lReplace("σ","å","gn")
  55.   lReplace("÷","ö","gn")
  56.   lReplace("─","Ä","gn")
  57.   lReplace("┼","Å","gn")
  58.   lReplace("╓","Ö","gn")
  59.   lReplace("ⁿ","ü","gn")
  60.   lReplace("▄","Ü","gn")
  61. end
  62.  
  63. // Convert 8-bit IBM PC Scandinavian characters to their 8-bit
  64. // Latin1 counterparts
  65. proc timoIbmToLat1()
  66.   lReplace("ä","Σ","gn")
  67.   lReplace("å","σ","gn")
  68.   lReplace("ö","÷","gn")
  69.   lReplace("Ä","─","gn")
  70.   lReplace("Å","┼","gn")
  71.   lReplace("Ö","╓","gn")
  72.   lReplace("ü","ⁿ","gn")
  73.   lReplace("Ü","▄","gn")
  74. end
  75.  
  76. // Covert Mac Scandinavian characters to their 8-bit IBM PC equivalents
  77. proc timoMac2Pc()
  78.   lReplace("î","å","gn")
  79.   lReplace("è","ä","gn")
  80.   lReplace("Ü","ö","gn")
  81.   lReplace("ü","Å","gn")
  82.   lReplace("Ç","Ä","gn")
  83.   lReplace("à","Ö","gn")
  84. end
  85.  
  86. // New keys and menus **************************************************
  87. forward Menu tIbmAscMenu()
  88. forward proc tDisableNewKeys()
  89.  
  90. // Add the new key definitions
  91. keydef new_keys
  92.   <CtrlAlt 1>      timoIbmToAsc()
  93.   <CtrlAlt 2>      timoAscToIbm()
  94.   <CtrlAlt 3>      timoLat1ToIbm()
  95.   <CtrlAlt 4>      timoIbmToLat1()
  96.   <CtrlAlt 5>      timoMac2Pc()
  97.   <CtrlAlt 0>      tDisableNewKeys()
  98.   <CtrlAlt H>      QuickHelp(tHelpData)
  99.   <F11>            tIbmAscMenu()
  100. end
  101.  
  102. // Disabling the new extra keys ***************************************
  103. proc tDisableNewKeys()
  104.   if YesNo("Disable the extra keys:") == 1 Disable(new_keys) endif
  105. end
  106.  
  107. // The IbmAsc menu ****************************************************
  108. Menu tIbmAscMenu()
  109.   Title = "Timo's conversion menu"
  110.   x = 40
  111.   y = 3
  112.   history
  113.   "Ibm&Asc  (7-bit)    <CtrlAlt 1>"   , timoIbmToAsc()
  114.   "Asc&Ibm  (8-bit)    <CtrlAlt 2>"   , timoAscToIbm()
  115.   "&Lat1Ibm (8-bit)    <CtrlAlt 3>"   , timoLat1ToIbm()
  116.   "IbmLat&1 (8-bit)    <CtrlAlt 4>"   , timoIbmToLat1()
  117.   "Mac2P&C  (8-bit)    <CtrlAlt 5>"   , timoMac2Pc()
  118.   "",,Divide
  119.   "Disable &new keys  <CtrlAlt 0>"   , tDisableNewKeys()
  120.   "&Help              <CtrlAlt H>"   , QuickHelp(tHelpData)
  121.   "This Menu         <F11>"
  122. end tIbmAscMenu
  123.  
  124. proc Main()
  125.   Enable (new_keys)
  126.   tIbmAscMenu()
  127. end
  128.